Rationalise xenstore header files a little. xenstored.h,
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 7 Oct 2005 15:49:29 +0000 (16:49 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 7 Oct 2005 15:49:29 +0000 (16:49 +0100)
which defines aspects of the 'wire' protocol between
xs daemon and clients in user and kernel land, is now
xs_wire.h and moved to xen's public/io directory. From there
it is more easily accessible by kernels.

Signed-off-by: Keir Fraser <keir@xensource.com>
15 files changed:
.hgignore
linux-2.6-xen-sparse/arch/ia64/Makefile
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
linux-2.6-xen-sparse/include/asm-xen/xenbus.h
linux-2.6-xen-sparse/mkbuildtree
tools/xenstore/speedtest.c
tools/xenstore/xenstored.h [deleted file]
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_core.h
tools/xenstore/xs.c
tools/xenstore/xs.h
tools/xenstore/xs_crashme.c
tools/xenstore/xs_lib.h
xen/include/public/io/xs_wire.h [new file with mode: 0644]

index 7dddc93cae39c2d11975cf74a2fecd97b2b67de1..72b8f826d783c8b6fb55b339c0904e194039e78d 100644 (file)
--- a/.hgignore
+++ b/.hgignore
 ^tools/xenstore/xenstore-read$
 ^tools/xenstore/xenstore-rm$
 ^tools/xenstore/xenstore-write$
-^tools/xenstore/xs_dom0_test$
+^tools/xenstore/xs_crashme$
 ^tools/xenstore/xs_random$
 ^tools/xenstore/xs_stress$
 ^tools/xenstore/xs_tdb_dump$
index e0751e9328b89efb062fdf0a7be842d9e99b0043..6e46f892de0e518f8d15eaac502b0c905fa12934 100644 (file)
@@ -88,7 +88,6 @@ archclean:
 
 CLEAN_FILES += include/asm-ia64/.offsets.h.stamp vmlinux.gz bootloader
 #CLEAN_FILES += include/asm-xen/xen-public include/asm-ia64/xen/asm-xsi-offsets.h
-#CLEAN_FILES += include/asm-xen/linux-public/xenstored.h
 #CLEAN_FILES += include/asm-xen/linux-public include/asm-xen/asm-ia64/hypervisor.h
 
 MRPROPER_FILES += include/asm-ia64/offsets.h
@@ -119,9 +118,6 @@ include/asm-ia64/.offsets.h.stamp:
 #      [ -e include/asm-xen/linux-public ] \
 #       || ln -s $(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/linux-public \
                include/asm-xen/linux-public
-       [ -e include/asm-xen/linux-public/xenstored.h ] \
-        || ln -s $(XEN_PATH)/tools/xenstore/xenstored.h \
-               include/asm-xen/linux-public/xenstored.h
        [ -e include/asm-xen/asm-ia64/hypervisor.h ] \
         || ln -s $(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypervisor.h \
                include/asm-xen/asm-ia64/hypervisor.h
index 45ccdfa3be26416e9d3d4ac7b65ce3295c37506b..a1d24be2b4344c34f7668ce097c5bdc30ae50922 100644 (file)
@@ -44,7 +44,6 @@
 #include <asm-xen/xenbus.h>
 #include <asm-xen/xen_proc.h>
 #include <asm/hypervisor.h>
-#include <asm-xen/linux-public/xenstored.h>
 
 struct xenbus_dev_data {
        /* Are there bytes left to be read in this message? */
index d239f6fcccc7f9ceb41c0fa2d5562f03e019ba20..744576c02f486d4089faae6736797b6479300bda 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/fcntl.h>
 #include <linux/kthread.h>
 #include <asm-xen/xenbus.h>
-#include <asm-xen/linux-public/xenstored.h>
 #include "xenbus_comms.h"
 
 #define streq(a, b) (strcmp((a), (b)) == 0)
index 821aca1da85ace7e11c3239fff057feccf7a75bc..219cc96b4f496fba1bc606e4e82cd18305730734 100644 (file)
@@ -33,9 +33,7 @@
 #include <linux/device.h>
 #include <linux/notifier.h>
 #include <asm/semaphore.h>
-
-/* FIXME there's got to be a better way to get at the XS_WATCH macros */
-#include <asm-xen/linux-public/xenstored.h>
+#include <asm-xen/xen-public/io/xs_wire.h>
 
 /* A xenbus device. */
 struct xenbus_device {
index cf7b0f59bb8166fa6294fa9cbd0da73dc2a6a52e..ba89b1982df46a71abc74cc81ad9b7f3041267d8 100755 (executable)
@@ -113,9 +113,6 @@ mkdir  ${AD}/include/asm-xen/xen-public
 cd     ${AD}/include/asm-xen/xen-public
 relative_lndir ../../../${RS}/../xen/include/public
 
-cd ${AD}/include/asm-xen/linux-public
-ln -sf ../../../${RS}/../tools/xenstore/xenstored.h
-
 # Arch-specific post-processing
 cd ${AD}
 if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-post ]; then
index 9fa1caea54ce8f779a18763dfdb4ad16bf18b4c7..632e926f56907dbb7153aa8ee293ab03090e08e1 100644 (file)
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
 
                if (i % print == 0)
                        write(1, ".", 1);
-               if (!xs_transaction_start(h, "/")) {
+               if (!xs_transaction_start(h)) {
                        kill_daemon(pid);
                        barf_perror("Starting transaction");
                }
diff --git a/tools/xenstore/xenstored.h b/tools/xenstore/xenstored.h
deleted file mode 100644 (file)
index a84018d..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Simple prototyle Xen Store Daemon providing simple tree-like database.
- * Copyright (C) 2005 Rusty Russell IBM Corporation
- *
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this source file (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy, modify,
- * merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef _XENSTORED_H
-#define _XENSTORED_H
-
-enum xsd_sockmsg_type
-{
-       XS_DEBUG,
-       XS_SHUTDOWN,
-       XS_DIRECTORY,
-       XS_READ,
-       XS_GET_PERMS,
-       XS_WATCH,
-       XS_WATCH_ACK,
-       XS_UNWATCH,
-       XS_TRANSACTION_START,
-       XS_TRANSACTION_END,
-       XS_OP_READ_ONLY = XS_TRANSACTION_END,
-       XS_INTRODUCE,
-       XS_RELEASE,
-       XS_GET_DOMAIN_PATH,
-       XS_WRITE,
-       XS_MKDIR,
-       XS_RM,
-       XS_SET_PERMS,
-       XS_WATCH_EVENT,
-       XS_ERROR,
-};
-
-#define XS_WRITE_NONE "NONE"
-#define XS_WRITE_CREATE "CREATE"
-#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
-
-/* We hand errors as strings, for portability. */
-struct xsd_errors
-{
-       int errnum;
-       const char *errstring;
-};
-#define XSD_ERROR(x) { x, #x }
-static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
-       XSD_ERROR(EINVAL),
-       XSD_ERROR(EACCES),
-       XSD_ERROR(EEXIST),
-       XSD_ERROR(EISDIR),
-       XSD_ERROR(ENOENT),
-       XSD_ERROR(ENOMEM),
-       XSD_ERROR(ENOSPC),
-       XSD_ERROR(EIO),
-       XSD_ERROR(ENOTEMPTY),
-       XSD_ERROR(ENOSYS),
-       XSD_ERROR(EROFS),
-       XSD_ERROR(EBUSY),
-       XSD_ERROR(EAGAIN),
-       XSD_ERROR(EISCONN),
-};
-struct xsd_sockmsg
-{
-       u32 type;
-       u32 len;                /* Length of data following this. */
-
-       /* Generally followed by nul-terminated string(s). */
-};
-
-/* FIXME we shouldn't have to declare this in two places, what's the right
-   way to share things between xenstored.h and xs.h? */
-enum xs_watch_type
-{
-       XS_WATCH_PATH = 0,
-       XS_WATCH_TOKEN,
-};
-
-#endif /* _XENSTORED_H */
index da305ad7ce9a42b0603c6641d2738f4eee5ee193..5e8562ce36e1ab3d6dcce99a81d2f5a6707ce205 100644 (file)
@@ -44,7 +44,6 @@
 #include "list.h"
 #include "talloc.h"
 #include "xs_lib.h"
-#include "xenstored.h"
 #include "xenstored_core.h"
 #include "xenstored_watch.h"
 #include "xenstored_transaction.h"
index 1967d8425caa4db3d04f2b4a342aac25d6e3a09d..e0e4d58886f413cb85a41d1cff8933eaf39fb397 100644 (file)
@@ -26,7 +26,6 @@
 #include <stdint.h>
 #include <errno.h>
 #include "xs_lib.h"
-#include "xenstored.h"
 #include "list.h"
 #include "tdb.h"
 
index 4f21bbc5908eedbda18935e7da926a0f723883e3..1b405f18f45bd3e75d9902eda900cd59936dd6e4 100644 (file)
@@ -33,8 +33,6 @@
 #include <errno.h>
 #include <sys/ioctl.h>
 #include "xs.h"
-#include "xenstored.h"
-#include "xs_lib.h"
 #include "utils.h"
 
 struct xs_handle
index 351f55a4101bab4925217d8020ac0620019109aa..3a3b94000b67c80e55231849d6c47dfcc0eb71b5 100644 (file)
 #ifndef _XS_H
 #define _XS_H
 
-#include "xs_lib.h"
+#include <xs_lib.h>
 
 struct xs_handle;
 
-/* FIXME we shouldn't have to declare this in two places, what's the right
-   way to share things between xenstored.h and xs.h? */
-enum xs_watch_type
-{
-       XS_WATCH_PATH = 0,
-       XS_WATCH_TOKEN,
-};
-
 /* On failure, these routines set errno. */
 
 /* Connect to the xs daemon.
index 748c64a2d4df6ca758120cdfd8578bd2cd410957..9d708ba2eb1f1af744d31f5630f426d687115e4e 100644 (file)
@@ -24,7 +24,6 @@
 #include "xs.h"
 #include "talloc.h"
 #include <errno.h>
-#include "xenstored.h"
 
 #define XSTEST
 #define RAND_FREQ 128          /* One char in 32 is corrupted. */
@@ -231,20 +230,6 @@ static char *random_path(void)
        return ret;
 }
 
-static int random_flags(int *state)
-{
-       switch (get_randomness(state) % 4) {
-       case 0:
-               return 0;
-       case 1:
-               return O_CREAT;
-       case 2:
-               return O_CREAT|O_EXCL;
-       default:
-               return get_randomness(state);
-       }
-}
-
 /* Do the next operation, return the results. */
 static void do_next_op(struct xs_handle *h, bool verbose)
 {
@@ -315,7 +300,7 @@ static void do_next_op(struct xs_handle *h, bool verbose)
        case 7: {
                if (verbose)
                        printf("START %s\n", name);
-               xs_transaction_start(h, name);
+               xs_transaction_start(h);
                break;
        }
        case 8: {
index 91abd4680cd73ac8a21a1b8716049e49618d3fd0..d446a1cc9c33cfd98da63968e487595854342c50 100644 (file)
@@ -23,6 +23,8 @@
 #include <stdbool.h>
 #include <limits.h>
 #include <xenctrl.h>
+#include <errno.h>
+#include <xen/io/xs_wire.h>
 
 /* Bitmask of permissions. */
 enum xs_perm_type {
diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
new file mode 100644 (file)
index 0000000..b530acf
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Details of the "wire" protocol between Xen Store Daemon and client
+ * library or guest kernel.
+ * Copyright (C) 2005 Rusty Russell IBM Corporation
+ *
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef _XS_WIRE_H
+#define _XS_WIRE_H
+
+enum xsd_sockmsg_type
+{
+       XS_DEBUG,
+       XS_SHUTDOWN,
+       XS_DIRECTORY,
+       XS_READ,
+       XS_GET_PERMS,
+       XS_WATCH,
+       XS_WATCH_ACK,
+       XS_UNWATCH,
+       XS_TRANSACTION_START,
+       XS_TRANSACTION_END,
+       XS_OP_READ_ONLY = XS_TRANSACTION_END,
+       XS_INTRODUCE,
+       XS_RELEASE,
+       XS_GET_DOMAIN_PATH,
+       XS_WRITE,
+       XS_MKDIR,
+       XS_RM,
+       XS_SET_PERMS,
+       XS_WATCH_EVENT,
+       XS_ERROR,
+};
+
+#define XS_WRITE_NONE "NONE"
+#define XS_WRITE_CREATE "CREATE"
+#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
+
+/* We hand errors as strings, for portability. */
+struct xsd_errors
+{
+       int errnum;
+       const char *errstring;
+};
+#define XSD_ERROR(x) { x, #x }
+static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
+       XSD_ERROR(EINVAL),
+       XSD_ERROR(EACCES),
+       XSD_ERROR(EEXIST),
+       XSD_ERROR(EISDIR),
+       XSD_ERROR(ENOENT),
+       XSD_ERROR(ENOMEM),
+       XSD_ERROR(ENOSPC),
+       XSD_ERROR(EIO),
+       XSD_ERROR(ENOTEMPTY),
+       XSD_ERROR(ENOSYS),
+       XSD_ERROR(EROFS),
+       XSD_ERROR(EBUSY),
+       XSD_ERROR(EAGAIN),
+       XSD_ERROR(EISCONN),
+};
+struct xsd_sockmsg
+{
+       u32 type;
+       u32 len;                /* Length of data following this. */
+
+       /* Generally followed by nul-terminated string(s). */
+};
+
+enum xs_watch_type
+{
+       XS_WATCH_PATH = 0,
+       XS_WATCH_TOKEN,
+};
+
+#endif /* _XS_WIRE_H */